home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 009a / ru01.zip / DISXGF.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-11  |  2KB  |  84 lines

  1. (* ******************************************************************* *)
  2. (* disxgf.pas For Turbo Pascal - Demonstrates how to display XGF files *)
  3. (*                               that are greater than 64K             *)
  4. (*                                                                     *)
  5. (* Use Raster Clip/Rastport to convert PCX files to XGF format.        *)
  6. (*                                                                     *)
  7. (* ******************************************************************* *)
  8.  
  9. Program disxgf;
  10.    uses crt,graph;
  11.  
  12.  
  13. {$F+}
  14. Function DetectVGA256 : integer;
  15. begin
  16.     DetectVGA256:=0;
  17. end;
  18. {$F-}
  19.  
  20.  
  21. Procedure setVGA256;
  22. Var
  23.  gd,gm : Integer;
  24. begin
  25.  gd:=InstallUserDriver('svga256',@detectvga256);
  26.  gd:=Detect;
  27.  Initgraph(gd,gm,'');
  28. end;
  29.  
  30.  
  31. Procedure setvga16;
  32. var
  33.  gd,gm : integer;
  34. begin
  35.  gd:=VGA;
  36.  gm:=VGALO;
  37.  
  38.  initgraph(gd, gm, '');
  39. end;
  40.  
  41. Procedure dis_xgf(x,y : integer; filename : string);
  42. var
  43.  F : File;
  44.  width,height,bpl,i,error : word;
  45.  scanline : array[1..1030] of word;
  46. begin
  47. {$I-}
  48.  Assign(F,filename);
  49.  Reset(F,1);
  50.  error:=IORESULT;
  51.  if (error=0) then
  52.  begin
  53.    blockread(F,width,2);
  54.    blockread(F,height,2);
  55.    scanline[1]:=width;
  56.    scanline[2]:=0;
  57.    if (getmaxcolor=255) then
  58.    begin
  59.      bpl:=width+1;
  60.    end
  61.    else
  62.    begin
  63.      bpl:=imagesize(0,0,width,0)-6;
  64.    end;
  65.    for i:=0 to (height-1) do
  66.    begin
  67.      blockread(F,scanline[3],bpl);
  68.      putimage(x,y+i,Ptr(seg(scanline),ofs(scanline))^,0);
  69.    end;
  70.    close(F);
  71.  end;
  72. {$I-}
  73. end;
  74.  
  75. begin
  76.   setvga16;          (* replace with setvga256 for 256 color XGF files *)
  77.  
  78.   setfillstyle(solidfill,BLUE);
  79.   bar(0,0,getmaxx,getmaxy);
  80.   dis_xgf(0,0,'image.xgf');
  81.   repeat until keypressed;
  82.   closegraph;
  83. end.
  84.